package com.indra.bbva.pe.monitor.in.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.indra.bbva.pe.monitor.in.dao.iface.VerificacionDAOIface;

@Repository
public class VerificacionDAOImpl extends SqlMapClientDaoSupport implements VerificacionDAOIface {
	private static final Logger log = Logger.getLogger(VerificacionDAOImpl.class);
	
	@Autowired
	public VerificacionDAOImpl(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}
	
	@SuppressWarnings("unchecked")
	public List<Map<String,Object>> ejecutarConsulta(String tipo,String consulta) throws Exception {
		Map<String,String> map = new HashMap<String,String>();
		map.put("IN_CONSULTA", consulta);
		map.put("IN_TIPO", tipo);
		
		log.info("sp: IIAF.PIIAF_MONITOR.sp_exe_ejecutar, params: "+map);
		List<Map<String,Object>> rows = getSqlMapClientTemplate().queryForList("BP_DUAL.spEjecutarConsulta",map);
		return rows;
	}
}